﻿using HTB.DevFx.Core;
using Maple.Weixin.MP.Entities.CustomerService;

namespace Maple.Weixin.MP
{
    /// <summary>
    /// 多客服服务。
    /// </summary>
    public interface IDkfService
    {
        /// <summary>
        /// 获取所有的客服信息。
        /// </summary>
        /// <returns>客服的数组。</returns>
        DkfAccount[] GetAccounts();

        /// <summary>
        /// 获取所有的客服信息
        /// </summary>
        /// <param name="accessToken">给定的AccessToken。</param>
        /// <returns></returns>
        DkfAccount[] GetAccounts(string accessToken);

        /// <summary>
        /// 获取所有当前可用客服信息。
        /// </summary>
        /// <returns>当前可用的客服数组。</returns>
        DkfOnline[] GetOnlineAccount();

        /// <summary>
        /// 获取所有当前可用客服信息
        /// </summary>
        /// <param name="accessToken">给定的AccessToken。</param>
        /// <returns></returns>
        DkfOnline[] GetOnlineAccount(string accessToken);

        /// <summary>
        /// 向系统添加多客服账号。
        /// </summary>
        /// <param name="accountName">账号名称，格式为账号前缀@公众号微信号。</param>
        /// <param name="nickName">昵称。</param>
        /// <param name="password">密码。格式为密码明文的32位加密MD5。</param>
        /// <returns>本次添加操作的结果。</returns>
        IAOPResult AddAccount(string accountName, string nickName, string password,bool isReturnAccount = false);

        /// <summary>
        /// 
        /// </summary>
        ///  <param name="accessToken">给定的AccessToken。</param>
        /// <param name="accountName"></param>
        /// <param name="nickName"></param>
        /// <param name="password"></param>
        /// <param name="isReturnAccount"></param>
        /// <returns></returns>
        IAOPResult AddAccount(string accessToken,string accountName, string nickName, string password, bool isReturnAccount = false);

        /// <summary>
        /// 设置某个客服的信息。
        /// </summary>
        /// <param name="accountName">账号名称，格式为账号前缀@公众号微信号。</param>
        /// <param name="nickName">昵称。</param>
        /// <param name="password">密码。格式为密码明文的32位加密MD5。</param>
        /// <returns>本次设置操作的结果。</returns>
        IAOPResult EditAccount(string accountName, string nickName, string password, bool isReturnAccount = false);

        /// <summary>
        /// 设置某个客服的信息。
        /// </summary>
        /// <param name="accessToken">给定的AccessToken。</param>
        /// <param name="accountName">账号名称，格式为账号前缀@公众号微信号。</param>
        /// <param name="nickName">昵称。</param>
        /// <param name="password">密码。格式为密码明文的32位加密MD5。</param>
        /// <returns>本次设置操作的结果。</returns>
        IAOPResult EditAccount(string accessToken,string accountName, string nickName, string password, bool isReturnAccount = false);

        /// <summary>
        /// 删除某个客服的账号。
        /// </summary>
        /// <param name="accountName">账号名称，格式为账号前缀@公众号微信号。</param>
        /// <returns>本次删除操作的结果。</returns>
        IAOPResult DeleteAccount(string accountName);

        /// <summary>
        /// 删除某个客服的账号
        /// </summary>
        /// <param name="accessToken">给定的AccessToken。</param>
        /// <param name="accountName">账号名称，格式为账号前缀@公众号微信号。</param>
        /// <returns>本次删除操作的结果</returns>
        IAOPResult DeleteAccount(string accessToken, string accountName);

        /// <summary>
        ///  获取聊天记录
        /// </summary>
        /// <param name="openid">普通用户的标识，对当前公众号唯一</param>
        /// <param name="starttime">查询开始时间，UNIX时间戳</param>
        /// <param name="endtime">查询结束时间，UNIX时间戳，每次查询不能跨日查询</param>
        /// <param name="pagesize">每页大小，每页最多拉取1000条</param>
        /// <param name="pageindex">查询第几页，从1开始</param>
        /// <returns></returns>
        DkfRecord[] GetChatRecords(string openid, string starttime, string endtime, int pagesize, int pageindex);

        /// <summary>
        ///  获取聊天记录
        /// </summary>
        /// <param name="accessToken">给定的AccessToken。</param>
        /// <param name="openid">普通用户的标识，对当前公众号唯一</param>
        /// <param name="starttime">查询开始时间，UNIX时间戳</param>
        /// <param name="endtime">查询结束时间，UNIX时间戳，每次查询不能跨日查询</param>
        /// <param name="pagesize">每页大小，每页最多拉取1000条</param>
        /// <param name="pageindex">查询第几页，从1开始</param>
        /// <returns></returns>
        DkfRecord[] GetChatRecords(string accessToken, string openid, string starttime, string endtime, int pagesize, int pageindex);

        /// <summary>
        /// 获取指定客服信息
        /// </summary>
        /// <param name="accountName">账号名称，格式为账号前缀@公众号微信号。</param>
        /// <returns></returns>
        DkfAccount GetAccount(string accountName);

        /// <summary>
        /// 获取指定客服信息
        /// </summary>
        ///  <param name="accessToken">给定的AccessToken。</param>
        /// <param name="accountName">账号名称，格式为账号前缀@公众号微信号。</param>
        /// <returns></returns>
        DkfAccount GetAccount(string accessToken, string accountName);
    }
}
